package com.singzi.leetcode.N900;

import java.util.HashSet;

public class T0829 {
}
class Solution0829 {
    public int consecutiveNumbersSum(int n) {

        int ans = 0;
        for(int i = 1;i*(i + 1)/2 <= n;i++){
            if(i%2==0){
                if((n - (i *(i-1))/2)%i == 0) ans++;
            }else{
                if(n >=i*(i + 1)/2 && n%i == 0)ans++;
            }

        }
        return ans;

    }
}